<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>魔狗微博登录</title>

    <!-- CSS -->
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
    <link rel="stylesheet" href="/static/assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/assets/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/assets/css/form-elements.css">
    <link rel="stylesheet" href="/static/assets/css/style.css">
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__CSS__/style.min.css" rel="stylesheet">
    <link href="__CSS__/login.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/static/assets/js/html5shiv.js"></script>
    <script src="/static/assets/js/respond.min.js"></script>
    <script src="__JS__/jquery.min.js?v=2.1.4"></script>
    <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
    <![endif]-->

    <!-- Favicon and touch icons -->
    <link rel="shortcut icon" href="/static/assets/ico/favicon.png">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/static/assets/ico/apple-touch-icon-57-precomposed.png">

</head>

<body class="bg">

<style>
    .bg{
        background:url("/static/assets/img/backgrounds/1.jpg");
    }
</style>
<!-- Top menu -->
<nav class="navbar navbar-inverse navbar-no-bg" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{:url('index/index/index')}"></a>
        </div>
</nav>

<!-- Top content -->
<div class="top-content">

    <div class="inner-bg">
        <div class="container">
            <div class="row">
                <div class="col-sm-7 text">
                    <h1><strong>魔狗</strong> 微博</h1>
                    <div class="description">
                        <p>
                            欢迎登录魔狗微博 <a href="{:url('index/index/index')}"><strong>《魔狗》</strong></a>, 体验全新版本!
                        </p>
                    </div>
                </div>
                <div class="col-sm-5 form-box">
                    <div class="form-top">
                        <div class="form-top-left">
                            <h3 class="btn btn-warning" style="margin-left: 150px">VipLogin!</h3>

                            <p>请填妥以下表格，以便即时查阅:</p>
                            <b>
                                还没有账号?<a href="{:url('index/index/add')}"><strong>点击立即注册</strong></a>
                            </b>
                            <br>
                            <a href="{:url('index/login/tellogin')}">使用手机号登录</a>
                        </div>
                        <div class="form-top-right">
                            <i class="fa fa-pencil"></i>
                        </div>
                    </div>
                    <div class="form-bottom">
                        <form role="form" method="post" action="{:url('index/login/dologin')}"class="registration-form">
                            <div class="form-group">
                                <label class="sr-only" for="form-first-name">username</label>
                                <input type="text" name="username" placeholder="用户名..." class="form-first-name form-control" id="form-first-name">
                            </div>
                            <div class="form-group">
                                <label class="sr-only" for="form-email">password</label>
                                <input type="password" name="password" placeholder="密码..." class="form-email form-control" id="form-email">
                            </div>
                            <button type="submit" class="btn btn-warning">立即登录!</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- Javascript -->
<script src="/static/assets/js/jquery-1.11.1.min.js"></script>
<script src="/static/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/assets/js/jquery.backstretch.min.js"></script>
<script src="/static/assets/js/retina-1.1.0.min.js"></script>
<script src="/static/assets/js/scripts.js"></script>

<!--[if lt IE 10]>
<script src="/static/assets/js/placeholder.js"></script>
<![endif]-->
<script type="text/javascript">
    document.onkeydown=function(event){
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // enter 键
            $('#login_btn').click();
        }
    };
    var lock = false;
    $(function () {
        $('#login_btn').click(function(){
            if(lock){
                return;
            }
            lock = true;
            $('#err_msg').hide();
            $('#login_btn').removeClass('btn-success').addClass('btn-danger').val('登陆中...');
            var username = $('#user_name').val();
            var password = $('#password').val();
            var code = $('#code').val();
            $.post("{:url('login/doLogin')}",{'user_name':username, 'password':password, 'code':code},function(data){
                lock = false;
                $('#login_btn').val('登录').removeClass('btn-danger').addClass('btn-success');
                if(data.code!=1){
                    $('#err_msg').show().html("<span style='color:red'>"+data.msg+"</span>");
                    return;
                }else{
                    window.location.href=data.data;
                }
            });
        });
    });
</script>
</body>

</html>